//
//  JYVerifyRegEx.m
//  MYCCBRegisterSubAccount
//
//  Created by 应明顺 on 2018/7/4.
//  Copyright © 2018年 JackYing. All rights reserved.
//

#import "JYVerifyRegEx.h"

@implementation JYVerifyRegEx

+ (instancetype)shareVerifyRegEx {
    static JYVerifyRegEx *verifyRegEx = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        verifyRegEx = [[JYVerifyRegEx alloc] init];
    });
    return verifyRegEx;
}


+ (BOOL)verifyInputString:(NSString *)input regEx:(NSString *)regEx {
    NSError *error = NULL;
    NSRegularExpression *reg = [NSRegularExpression regularExpressionWithPattern:regEx options:(NSRegularExpressionCaseInsensitive) error:&error];
    NSArray *result = [reg matchesInString:input options:(NSMatchingReportProgress) range:NSMakeRange(0, input.length)];
    // 没匹配到不对
    return result.count;
}


@end
